# Php-fpm
# Version 1.0
# docker container run -d --name php-fpm -v /Users/makeup1122/temp/docker:/var/www/html  php:fpm-alpine
# docker container run -d --name php-fpm -v /Users/makeup1122/temp/docker/www:/var/www/html -p 9001:9000 php:fpm-alpine
# docker container run -d --name php-fpm --network web-net -v /Users/makeup1122/temp/docker/www:/var/www/html -p 9001:9000 php:fpm-alpine
# docker run --rm --interactive --tty --volume $PWD:/app composer install

#build-stage
# FROM composer as build-stage
# WORKDIR /app
# COPY . .
# RUN composer install

#production-stage
FROM php:fpm-alpine
WORKDIR /var/www/html

# 安装install-php-extensions
ADD ./install-php-extensions /usr/local/bin/
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN chmod uga+x /usr/local/bin/install-php-extensions && sync && install-php-extensions pdo_mysql
COPY docker-entrypoint.sh /usr/local/bin
RUN chmod uga+x /usr/local/bin/docker-entrypoint.sh
# 使用multi-build stage
# COPY --from=build-stage /app/vendor ./vendor

#数据库迁移、目录权限设置、启动php-fpm
ENTRYPOINT [ "docker-entrypoint.sh" ]
